<?php if (Yii::app()->session["member_level"] != "admin" and Yii::app()->session["member_id"] == NULL): 
echo $this->redirect(Yii::app()->homeUrl);
endif; ?>
<div class="panel">
    <?php echo $this->beginContent("/product/Toolbar", array("current" => 1)); ?>
    <?php echo $this->endContent(); ?>

    <div class="panel_body">
        <?php echo CHtml::link("+ เพิ่มข้อมูลกลุ่มสินค้า", array("Product/ProductCategoryForm"), array("class" => "button")); ?>
        <?php
        $gridView = $this->widget('zii.widgets.grid.CGridView', array(
            'id' => 'company-grid',
            'dataProvider' => $model->search(),
            'htmlOptions' => array('width' => '500px'),
            'columns' => array(
                'product_category_name_thai',
                'product_category_name_eng',
                'product_category_description',
                'product_category_code',
                array(
                    'header' => 'edit',
                    'class' => 'CLinkColumn',
                    'imageUrl' => 'images/site/edit.png',
                    'urlExpression' => 'Yii::app()->createUrl("Product/ProductCategoryForm", array("id" => $data->id))',
                    'htmlOptions' => array(
                        'width' => '35px',
                        'align' => 'center'
                    )
                ),
                array(
                    'header' => 'delete',
                    'class' => 'CLinkColumn',
                    'imageUrl' => 'images/site/delete.png',
                    'urlExpression' => 'Yii::app()->createUrl("Product/ProductCategoryDelete", array("id" => $data->id))',
                    'htmlOptions' => array(
                        'width' => '35px',
                        'align' => 'center',
                        'onclick' => 'return confirm("ยืนยันการลบ")'
                    )
                )
            ),
        ));
        ?>
    </div>
</div>